//
//  CMDBDeletePicParam.swift
//  CMDB
//
//  Created by 王磊 on 17/4/12.
//  Copyright © 2017年 CMDB. All rights reserved.
//

import UIKit

class CMDBDeletePicParam: CMDBBasicParamBean {
    
    var aid: String = ""
    
    var name: String {
        
        guard tempName.count != 0 else {
            
            return ""
        }
        return CMDBDeletePicParam.castNamesToString(tempName)
    }
    
    var tempName: Array<String> = []
}
extension CMDBDeletePicParam {
    
    override func URLString() -> String {
        
        return CMDB_Http_Formal_Domain + "/app/works/\(server_Version)/delPics?"
    }
}
extension CMDBDeletePicParam {
    
    static func castNamesToString(arr: Array<String>) -> String {
        
        let mutable = NSMutableArray()
        
        _ = arr.map({
            
            mutable.addObject($0)
            
        })
        
        let jsonData = try? NSJSONSerialization.dataWithJSONObject(mutable, options: .PrettyPrinted)
        
        guard let jsonTemp = jsonData else {
            
            return ""
        }
        let jsonStr = String(data: jsonTemp,encoding: NSUTF8StringEncoding)
        
        return jsonStr!
    }
    
    
}